
# coding: utf-8

# In[1]:


print("Hello world")


# In[2]:


sum = 99999*99999
print(sum)


# In[3]:


months="JanFebMarAprMayJunJulAugSepOctNovDec" 
n = 4
monthAbbrev = months[(n-1)*3:(n-1)*3+3]
print(monthAbbrev)


# In[5]:


def mean(numbers):
    s = 0.0
    for num in numbers:
        s = s + num
    return s / len(numbers)
nums = [0,1,2,3,4,5,6,7,8,9]
print(mean(nums))


# In[6]:


from random import random
rnd = random()*10
print(rnd)


# In[7]:


from PIL import Image
from PIL import ImageFilter
im = Image.open('np.jpg')
e33 = im.filter(ImageFilter.CONTOUR)
e33.save('E(33).jpg')


# In[8]:


var = input("请输入带温度表示符号的温度值（例如32C）：")
if var[-1] in ['C','c']:
    f = 1.8*float(var[0:-1]) + 32
    print("转换后的温度为：%0.2f"%f)
elif val[-1] in ['F','f']:
    c = (float(ar[0:-1]) - 32 )/1.8
else :
    print("输入错误！")


# In[1]:


import turtle
def drawSnake (rad,  angle ,  len,  neckrad):
    for  i  in  range (len) :
        turtle.circle (rad ,  angle)
        turtle.circle (-rad,  angle)
    turtle.circle (rad,angle/2)
    turtle.fd (rad)
    turtle.circle (neckrad+1,180)
    turtle.fd (rad*2/3)
def main():
    turtle.setup (1300,800,0,0)
    pythonsize  =  30
    turtle.pensize (pythonsize)
    turtle.pencolor ("blue" )
    turtle.seth(-40)
    drawSnake (40 ,80 ,5 ,pythonsize/2)
main ()


# In[1]:


pow(2,10)
pow(2,15)
pow(2, 100)
pow(2, pow(2,15))


# In[2]:


import sys
sys.float_info


# In[6]:


z = 1.23e-4+5.6e+89j
type(z)


# In[8]:


import math
math.ceil(10.2)


# In[9]:


from math import floor
floor(10.2)


# In[10]:


import math
dayup = math.pow((1.0 + 0.001), 365)   # 提高0.001
daydown = math.pow((1.0 - 0.001), 365) # 放任0.001
print("向上: {:.2f}, 向下: {:.2f}.".format(dayup, daydown))


# In[11]:


import math
dayup = math.pow((1.0 + 0.005), 365)   # 提高0.005
daydown = math.pow((1.0 - 0.005), 365) # 放任0.005
print("向上: {:.2f}, 向下: {:.2f}.".format(dayup, daydown))


# In[12]:


import math
dayfactor = 0.01
dayup = math.pow((1.0 + dayfactor), 365)    # 提高dayfactor
daydown = math.pow((1.0 - dayfactor), 365)  # 放任dayfactor
print("向上: {:.2f}, 向下: {:.2f}.".format(dayup, daydown))


# In[15]:


dayup, dayfactor = 1.0, 0.01
for i in range(365):
    if i % 7 in [6, 0]:#周六周日
        dayup = dayup * (1 - dayfactor)
    else:
        dayup = dayup * (1 + dayfactor)
print("向上5天向下2天的力量: {:.2f}.".format(dayup))


# In[17]:


plaincode = input("请输入明文: ")
for p in plaincode: 
    if ord("a") <= ord(p) <= ord("z"):
        print(chr(ord("a")+(ord(p)-ord("a")+3)%26), end='')
    else:
        print(p, end='')


# In[18]:


import time
scale = 10
print("------执行开始------")
for i in range(scale+1):
    a, b = '**' * i,'..' * (scale - i)
    c = (i/scale)*100
    print("%{:^3.0f}[{}->{}]" .format (c, a, b))
    time.sleep(0.1)
print("------执行结束------")


# In[19]:


import time
for i in range(101):
    print("\r{:2}%".format(i), end="")
    time.sleep(0.05)


# In[20]:


import time
scale = 50
print("执行开始".center(scale//2,'-'))
t = time.clock()
for i in range(scale+1):
    a = '*' * i
    b = '.' * (scale - i)
    c = (i/scale)*100 
    t -=  time.clock()
    print("\r{:^3.0f}%[{}->{}]{:.2f}s".format(c,a,b,-t),end='')
    time.sleep(0.05)
print("\n"+"执行结束".center(scale//2,'-'))

